<template>
<h1>表单组件</h1>
  <el-form style="width: 500px;margin: 0 auto;" label-width="80">
    <el-form-item label="姓名">
      <el-input v-model="name" placeholder="请输入姓名"></el-input>
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="password"  show-password placeholder="请输入姓名"></el-input>
    </el-form-item>

    <el-form-item label="性别">
     <el-radio-group v-model="sex">
      <el-radio label="男">男</el-radio>
      <el-radio label="女">女</el-radio>
    </el-radio-group>
    </el-form-item>
    <el-form-item>
    <el-select v-model="city" placeholder="请选择" >
      <el-option label="上海" value="sh"></el-option>
      <el-option label="北京" value="bj"></el-option>
      <el-option label="深圳" value="sz"></el-option>
    </el-select>
    </el-form-item>
    <el-form-item label="管理员">
     <el-switch v-model="value1"  />
    </el-form-item>
    <el-form-item>
      <el-button type="success"  @click="submit">提交</el-button>
      <el-button @click="reset">重置</el-button>
    </el-form-item>
  </el-form>
</template>
<script setup>

import {ref} from "vue";
const value1 = ref(false);
const name = ref('');
const password = ref('');
const sex = ref('');
const city = ref('');
const submit = () => {
  alert(name.value+'\n' +password.value+"\n"+sex.value+"\n"+city.value);
};
const reset = () => {
  name.value = '';
  password.value = '';
  sex.value = '';
  city.value = '';
};
</script>


<style scoped>

</style>